package com.example.myadmin.student.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.myadmin.dept.entity.Dept;
import com.example.myadmin.student.entity.Student;
import com.example.myadmin.student.mapper.StudentMapper;
import com.example.myadmin.student.service.StudentService;
import com.example.myadmin.student.vo.StudentQuery;
import com.example.myadmin.user.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper,Student> implements StudentService {

    @Autowired
    private StudentMapper studentMapper;

    @Override
    public void deleteStudentByIds(String ids) {
        //将前端传来的以逗号分隔的字符串转为List集合
        String[] split = ids.split(",");
        List<String> list = Arrays.asList(split);
        studentMapper.deleteBatchIds(list);
    }

    @Override
    public Student selectStudentById(Integer id) {
        return studentMapper.selectById(id);
    }

    @Override
    public void updateStudentById(Student student) {
        studentMapper.updateById(student);
    }

}
